<template>
  <div class="tag" style="margin-bottom: 1vw">
    天气预报
  </div>
  <div class="weather-card">
    <!-- 上方横向布局 -->
    <div class="top-section">
      <div class="location">
        <span class="icon">📍</span>
        <span class="text" style="font-weight: bolder; font-size: 18px;">普洱市思茅区南屏镇瑞嘉蔬菜基地</span>
      </div>

      <div class="publish-time">
        <span class="icon">🕒</span>
        <span class="text">昆明 14:24 发布</span>
      </div>
    </div>

    <!-- 中间部分：温度和天气状况并排 -->
    <div class="middle-section">
      <div class="temperature-weather">
        <div class="temperature">
          <span class="value" style="font-size: 2vw">15°C</span>
        </div>
        <div class="weather-condition">
          <span class="icon">🌤️</span>
          <span class="text">多云</span>
        </div>
      </div>
    </div>

    <!-- 下方竖向布局 -->
    <div class="bottom-section">
      <div class="time-temperature">
        <div class="time-range">
          <span class="start-time">07:31</span>
          <span class="separator">~</span>
          <span class="end-time">18:31</span>
        </div>
        <div class="temperature-range">
          <span class="text">7° ~ 17°</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'WeatherCard',
};
</script>

<style scoped>
.tag {
  text-align: center;
  font-size: 1vw; /* 调小字体 */
  font-weight: bold;
  color: #00eaff;
  text-shadow: 0px 0px 8px #00eaff; /* 标题发光效果 */
  margin-bottom: 1vw;
}
.weather-card {
  margin: 1vw;
  width: 22vw;  /* 适应父容器的宽度 */
  height: 8vw; /* 适应父容器的高度 */
  padding: 20px;
  background: linear-gradient(135deg, #0b2bbe, #2a5298);
  border-radius: 20px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  color: white;
  font-family: 'Arial', sans-serif;
  text-align: center;
  transition: transform 0.3s ease-in-out;
}

.weather-card:hover {
  transform: translateY(-10px);
}

/* 保持原有样式，确保内容适配 */
.top-section {
  justify-content: space-between;
  margin-bottom: 20px;
}

.location, .publish-time {
  font-size: 16px;
  display: flex;
  align-items: center;
  color: #f1f1f1;
}

.location .icon, .publish-time .icon {
  margin-right: 8px;
  font-size: 18px;
}

.middle-section {
  margin-bottom: 20px;
}

.temperature-weather {
  display: flex;
  justify-content: center;
  align-items: center;
}

.temperature {
  font-size: 80px;
  font-weight: 700;
  color: #fff;
  margin-right: 10px;
  display: flex;
  align-items: center;
}

.weather-condition {
  font-size: 10px;
  display: flex;
  align-items: center;
  color: #f1f1f1;
}

.weather-condition .icon {
  margin-right: 8px;
  font-size: 24px;
}

.bottom-section {
  margin-top: 20px;
}

.time-temperature {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
}

.time-range, .temperature-range {
  color: #ddd;
}

.time-range {
  display: flex;
  align-items: center;
}

.time-range .separator {
  margin: 0 10px;
}

.temperature-range {
  color: #bbb;
}

@media screen and (max-width: 360px) {
  .weather-card {
    width: 100%;
  }

  .temperature {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .middle-section {
    flex-direction: column;
    align-items: center;
  }

  .time-temperature {
    flex-direction: column;
    align-items: center;
  }
}
</style>
